package info.fqtech.weipan.utils;

import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;

/**
 * properties文件读取工具类
 * Created by admin on 2017/4/11.
 */
public class PropertiesUtil {

    /**
     * 根据properties文件名称创建Properties对象
     * @param PropertiesFileName
     * @return
     */
    public static Properties getProperties(String PropertiesFileName){
        Properties properties = null;
        InputStreamReader in = null;
        try {
            in = new InputStreamReader(PropertiesUtil.class.getClassLoader().getResourceAsStream(PropertiesFileName),"UTF-8");
            properties = new Properties();
            properties.load(in);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if(in != null){
                try {
                    in.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return properties;
    }

}
